<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('用户资金记录列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <input type="hidden"  id="tranTypeShow" th:value="${tranTypeShow}">
                    <input type="hidden"  id="customerIdShow" th:value="${customerIdShow}">

                    <div class="select-list">
                        <ul>
                            <li>
                                <label>客户ID：</label>
                                <input type="text" id="customerId" name="customerId"/>
                            </li>
                            <li>
                                <label>交易号：</label>
                                <input type="text" id="tranNo" name="tranNo" th:value="${orderNo}"/>
                            </li>
                            <li>
                                <label>支付渠道：</label>
                                <select name="payChannel" th:with="type=${@dict.getType('payChannel')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>账变类型：</label>
                                <select name="billChangeType" th:with="type=${@dict.getType('billChangeType')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>交易类型：</label>
                                <select id="tranType" name="tranType" th:with="type=${@dict.getType('tranType')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>启用状态：</label>
                                <select name="status" th:with="type=${@dict.getType('enableStatus')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="biz:tranlog:edit">-->
<!--                    <i class="fa fa-edit"></i> 修改-->
<!--                </a>-->
<!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="biz:tranlog:remove">-->
<!--                    <i class="fa fa-remove"></i> 删除-->
<!--                </a>-->
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="biz:tranlog:export">
                    <i class="fa fa-download"></i> 导出
                </a>
                <a id="closeId" style="display: none;" class="btn btn-warning" onclick="closeItem()">
                    <i class="fa fa-reply-all"></i> 返回
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
     <th:block th:include="include :: bootstrap-table-fixed-columns-js" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('biz:tranlog:edit')}]];
        var removeFlag = [[${@permission.hasPermi('biz:tranlog:remove')}]];
        var payChannelDatas = [[${@dict.getType('payChannel')}]];
        var billChangeTypeDatas = [[${@dict.getType('billChangeType')}]];
        var tranTypeDatas = [[${@dict.getType('tranType')}]];
        var statusDatas = [[${@dict.getType('enableStatus')}]];
        var prefix = ctx + "biz/tranlog";

        $(function() {
            var tranTypeShow = $("#tranTypeShow").val();
            var customerIdShow = $("#customerIdShow").val();
            var tranNo = $("#tranNo").val();
            console.log("tranTypeShow:",tranTypeShow)
            console.log("customerIdShow:",customerIdShow)
            console.log("tranNo:",tranNo)
            if(customerIdShow != '' || tranNo != '' ){
                $("#closeId").show();
            }
            if(tranTypeShow != ''){
                $("#tranType").val(tranTypeShow);
            }
            $("#customerId").val(customerIdShow);
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                fixedColumns: true,
                fixedRightNumber: 1,
                sortName: "id",
                sortOrder: "desc",
                modalName: "用户资金记录",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '',
                    visible: false
                },
                {
                    field: 'customerId',
                    title: '客户ID',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 10, 'open');
                    }
                },
                {
                    field: 'tranNo',
                    title: '交易号',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 20, 'open');
                    }
                },
                {
                    field: 'payChannel',
                    title: '支付渠道',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(payChannelDatas, value);
                    }
                },
                {
                    field: 'billChangeType',
                    title: '账变类型',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(billChangeTypeDatas, value);
                    }
                },
                {
                    field: 'tranType',
                    title: '交易类型',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(tranTypeDatas, value);
                    }
                },
                // {
                //     field: 'tranFee',
                //     title: '交易金额(元)',
                //     formatter: function (value, row, index) {
                //         return $.table.tooltip(value, 10, 'open');
                //     }
                // },
                {
                    field: 'payFee',
                    title: '交易金额(元)',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 10, 'open');
                    }
                },
                {
                    field: 'remark',
                    title: '备注',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 10, 'open');
                    }
                },
                {
                    field: 'createTime',
                    title: '交易时间',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 20, 'open');
                    }
                },
                {
                    field: 'status',
                    title: '启用状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(statusDatas, value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        // actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i> 编辑</a> ');
                        actions.push('<a style="margin-top: 3px;" class="btn btn-warning btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="detail(\'' + row.id + '\')"><i class="fa fa-search"></i> 详情</a> ');
                        // actions.push('<a style="margin-top: 3px;" class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i> 删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        function detail(id) {
            var url = prefix + '/detail/' + id + "?time=" + (new Date()).getTime();
            $.modal.openTab("用户资金记录详情", url);
        }
    </script>
</body>
</html>